Skip to content

Add rector rule to rename Form::_execute() to process()#353

Merged
LordSimal merged 2 commits into5.xfrom
form-execute-to-process-rector
Nov 10, 2025
Merged

Add rector rule to rename Form::_execute() to process()#353
LordSimal merged 2 commits into5.xfrom
form-execute-to-process-rector

Conversation

@dereuromark
Copy link
Copy Markdown
Member

Summary

Adds a new rector rule FormExecuteToProcessRector that automatically renames deprecated Form::_execute() methods to process() for CakePHP 5.3+.

  • Form::_execute() is deprecated in CakePHP 5.x
  • The new process() method accepts the same parameters and has the same return type
  • The rule includes a safety check to skip renaming if process() already exists to avoid conflicts

Changes

  • New Rector Rule: src/Rector/Rector/ClassMethod/FormExecuteToProcessRector.php

    • Handles renaming _execute() to process() in Form classes
    • Preserves method signature (parameters and return type)
    • Skips transformation if process() already exists
  • Tests: Complete test coverage with:

    • Basic transformation test
    • Skip logic test (when process() already exists)
    • All tests passing ✓
  • Configuration: Added to config/rector/sets/cakephp53.php for CakePHP 5.3 migration

Test plan

  • Unit tests pass (2 tests, 3 assertions)
  • Code style check (phpcs) passes
  • PHPStan analysis passes
  • Integration test verified with sample Form class
  • Skip logic verified when process() method exists

🤖 Generated with Claude Code

dereuromark and others added 2 commits November 10, 2025 16:51
Form::_execute() is deprecated in CakePHP 5.x and should be renamed to process() which accepts the same parameters and has the same return type.

This rector rule automatically handles the renaming while checking that process() doesn't already exist to avoid conflicts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@LordSimal LordSimal merged commit 4ab5d33 into 5.x Nov 10, 2025
2 of 3 checks passed
@LordSimal LordSimal deleted the form-execute-to-process-rector branch November 10, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants